#ifndef CHARACTER_H
#define CHARACTER_H

#include <QObject>
#include <QColor>

class Character : public QObject
{
    Q_OBJECT
    Q_PROPERTY(float x READ x WRITE setX NOTIFY xChanged)
    Q_PROPERTY(float y READ y WRITE setY NOTIFY yChanged)
    Q_PROPERTY(Direction dir READ dir WRITE setDir NOTIFY dirChanged)
    Q_PROPERTY(bool moving READ moving WRITE setMoving NOTIFY movingChanged)
    Q_PROPERTY(CharType type READ type WRITE setType NOTIFY typeChanged)
    Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
    Q_PROPERTY(qint32 score READ score WRITE setScore NOTIFY scoreChanged)
    Q_PROPERTY(qint32 kill READ kill WRITE setKill NOTIFY killChanged)
    Q_PROPERTY(qint32 death READ death WRITE setDeath NOTIFY deathChanged)
    Q_PROPERTY(qint32 life READ life WRITE setLife NOTIFY lifeChanged)

public:
    explicit Character(QObject *parent = 0);

    enum Direction { NORTH, EAST, SOUTH, WEST };
    enum CharType { PACMAN = 0, SUPER_PACMAN, GHOST};


    float x() const;
    float y() const;
    Direction dir() const;
    bool moving() const;
    CharType type() const;
    QColor color() const;
    qint32 score() const;
    qint32 kill() const;
    qint32 death() const;
    qint32 life() const;

signals:
    void xChanged(qint32 x);
    void yChanged(qint32 y);
    void dirChanged(Direction dir);
    void movingChanged(bool moving);
    void typeChanged(CharType type);
    void colorChanged(const QColor& color);
    void scoreChanged(qint32 score);
    void killChanged(qint32 kill);
    void deathChanged(qint32 death);
    void lifeChanged(qint32 life);

public slots:
    void setX(float x);
    void setY(float y);
    void setDir(Direction dir);
    void setMoving(bool moving);
    void setType(CharType type);
    void setColor(const QColor& color);
    void setScore(qint32 score);
    void setKill(qint32 kill);
    void setDeath(qint32 death);
    void setLife(qint32 life);

private:
    float p_x;
    float p_y;
    Direction p_dir;
    bool p_moving;
    CharType p_type;
    QColor p_color;
    qint32 p_score;
    qint32 p_kill;
    qint32 p_death;
    qint32 p_life;
};

#endif // CHARACTER_H
